/**
*      author: Y_Yao
*      created: 2024-09-28 11:07:23
**/

#include<bits/stdc++.h>

using namespace std;
using LL = long long;
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 9;
int a[N];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n = 0;
    cin >> n;
    stack<int> st;
    for(int i = 0;i < n;i++) cin >> a[i];
    for(int i = 1;i <n;i++)
    {
        while(!st.empty() && a[i] > st.top())
            st.pop();
        st.push(a[i]);
    }

    cout << st.size() - 1 << endl;
    return 0;
}